﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Code_Group3.WEBFORM
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {

        }

        protected void Button5_Click(object sender, EventArgs e)
        {
            Session["CardID"] = txtCardID.Text;
            Session["PIN"] = txtPIN.Text;
            Data.Card obj = new Data.Card();
            BUS.CardBUS db = new BUS.CardBUS();
            obj.CARDID = txtCardID.Text;
            if (db.CheckCard(obj) == true)
            {
                if (Session["PIN"].ToString() == db.Getpin(obj))
                {
                    Response.Redirect("Main.aspx");
                }
                else
                {
                    Session["Error"] = "Pin";
                    Response.Redirect("Login.aspx");
                    //Label7.Text = Session["Error"].ToString();
                }
            }
            else {
                Session["Error"] = "CardID";
                 Response.Redirect("Login.aspx");
                 //Label7.Text = Session["Error"].ToString();
            }
        }
       
        protected void btn1_Click(object sender, EventArgs e)
        {
            
            if (txtCardID.Text.Length < 8)
            {
                txtCardID.Text = txtCardID.Text + "1";
            }
            else if(txtCardID.Text.Length >= 8)
            {
                    txtPIN.Text = txtPIN.Text + "1";
                    if (txtPIN.Text.Length == 8)
                    { 
                        
                    }
            }
                
            
        }
    }
}